//
//  RedDotView.swift
//  SmartHousekeeper
//
//  Created by 刘森 on 2020/2/23.
//  Copyright © 2020 LS. All rights reserved.
//

import UIKit


class RedDotView: UIView {
    
  
    
    var countLabel: UILabel?
    let layerWidth: CGFloat = 24
    lazy var countLabelStyle = { () -> UILabel in
        let value = UILabel()
        value.textAlignment = .center
        value.layer.cornerRadius = self.layerWidth / 2
        value.backgroundColor = UIColor.red
        value.layer.masksToBounds = true
        value.textColor = UIColor.white
        value.font = KFont(13)
        return value
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        countLabel?.frame = CGRect(x: self.bounds.width - layerWidth / 2, y: 0 - layerWidth / 2, width: layerWidth, height: layerWidth)
    }
    
    private func getCountLabelText(string: String) {
        if countLabel == nil {
            countLabel = countLabelStyle()
        }
        countLabel?.isHidden = true

        countLabel?.text = string
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
